package es

import (
	"fmt"
	"github.com/elastic/go-elasticsearch/v8"
	"luck/appconfig"
)

var ElasticSearchClient *elasticsearch.Client

func Init() {
	var err error
	cfg := elasticsearch.Config{
		Addresses: []string{
			appconfig.Config.Es.Address,
		},
	}
	ElasticSearchClient, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(err)
	}
	fmt.Println("es连接成功")

}
